<template>
	<view>
		最近播放
		<view class="songsList" v-for="(item,index) in songsList" :key='index' style="display: flex;"
			@click="getSongURL(item.id)">
			<view class="topText">
				<text>{{index + 1}}</text>
			</view>
			<view class="xml">

				<view class="topName">
					<text>{{item.song.name}}</text>
				</view>
				<view class="topmen">
					<block v-for="(name,i) in item.song.ar" :key='i'>
						<text>{{name.name}}/</text>
					</block>
					<text>{{item.al.name}}</text>
				</view>
			</view>
		</view>
		<text>\n\n\n\n\n\n</text>
		<view class="zaudio" v-show="paused !== true ">
			<my-zaudio theme="theme3" ref='a'></my-zaudio>
		</view>
	</view>
</template>

<script>
	import {mapGetters} from 'vuex'
	export default {
		data() {
			return {
				userInfo: {},
				songsList: []
			}
		},
		created() {
			this.getUserInfo()
		},
		methods: {
			async getUserInfo() {
				let a = uni.getStorageSync('userInfo')

				if (a) {

					this.userInfo = JSON.parse(a)
				}
				const res = await this.$request({
					url: '/user/record',
					data: {
						uid: this.userInfo.userId
					}
				})
				if (res.code === 200) {
					this.songsList = res.allData
				}
				console.log(this.songsList)
			}
		},
		computed:{
			...mapGetters(['audiolist', 'playinfo', 'paused'])
		}
	}
</script>

<style scoped>

</style>
